#!/usr/bin/env python
# coding:utf-8
import sys
def _input():
    """
    输入 python 脚本名.py 1-5   #显示1-5 行的数据
    输入 python 脚本名.py 李慧  #显示与"李慧"相关的行
    或者 python 脚本名.py LH
    """

def read_class_members(info):
    with open('python_class_members.txt') as fd:
        if '-' in info:
            info = info.split('-')
            for line in fd.readlines()[int(info[0])-1:int(info[1])]:
                print line
        else:
            for line in fd.readlines():
                line = line.strip().split()
                if info.upper() in line:
                    str_line = '     '.join(line)
                    print str_line
                    break
            else:
                print "要查找的%s信息不存在" % info
                print _input.__doc__


if __name__ == "__main__":
    search = raw_input("请输入相关查找信息: ")
    if len(search) == 0:
        print _input.__doc__
        sys.exit()
    read_class_members(search)
